/*
 * @Author: scopesang
 * @Date: 2022-05-10 11:49:39
 * @LastEditors: scopesang
 * @LastEditTime: 2022-05-10 13:23:51
 * @FilePath: \TypeScript\src\class\Animal.ts
 * @Description: 类（掌握）
 * 
 * Copyright (c) 2022 by scopesang/大鹏科技, All Rights Reserved. 
 */
class Animal {
    // 在ts 上必须先声明。
    nihao: string;
    name: string; // 声明了Animal类中的name属性必须为string类型
    constructor(name: string) {
        this.name = name;
        this.nihao = name
    }
    sayName(): void {
        console.log(this.name);

    }
}

let dog = new Animal('dog')
dog.sayName()

class Man extends Animal {
    sex: string
    constructor(name: string, sex: string) {
        super(name)
        this.sex = sex
    }


    shot(): void {
        console.log(`${this.name}${this.sex}`);

    }
}

let man = new Man('男', '男')
man.shot()